package com.isoft.service.tableservice;

import com.isoft.dao.tabledao.DfmeFettDao;
import com.isoft.entity.tableentity.dfme_fett.DfmeFettMsg;
import com.isoft.utils.TimeFormatUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.text.ParseException;

@Service
@Slf4j
public class DfmeFettService {
    @Autowired
    DfmeFettDao dfmeFettDao;
    public int insertmsg(DfmeFettMsg dfmeFettMsg) throws ParseException {
        Timestamp create_time = new Timestamp(System.currentTimeMillis());
        Timestamp fett= TimeFormatUtils.stringToTimestamp(dfmeFettMsg.getDfmeFettDflt().getFett());
        Timestamp felt= TimeFormatUtils.stringToTimestamp(dfmeFettMsg.getDfmeFettDflt().getFelt());
        dfmeFettDao.insertMeta(create_time,dfmeFettMsg.getDfmeFettMeta());
        return  dfmeFettDao.insertDflt(dfmeFettMsg.getDfmeFettMeta().getSeqn(),create_time,fett,felt,dfmeFettMsg.getDfmeFettDflt());
    }
}
